package com.hstcs.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.hstcs.assets.Assets;
import com.hstcs.assets.Config;
import com.hstcs.assets.FileName;
import com.hstcs.game.XGame;
import com.hstcs.update.UpdateManager;

public class SplashScreen implements Screen {
	public SpriteBatch batcher;
	public Stage stage;
	
	
	@Override
	public void render(float delta) {
		// TODO Auto-generated method stub

		if (Assets.assetManager.update() == true) {
			Assets.loadfinish();
			XGame.getInstance().setScreen(MainMenuScreen.getInstance());
		}

		stage.draw();
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		Assets.load();
	
		stage = XGame.getInstance().stage;
		Image bg  = new Image(new Texture(Gdx.files.internal(FileName._BG_START)));
		bg.setFillParent(true);
		stage.addActor(bg);
	//	UpdateManager.getInstance().updateCode();	
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub

	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}
}
